package com.hairline.service;

import com.hairline.bean.vo.StatGoods;
import com.hairline.bean.vo.StatOrderRowsBean;
import com.hairline.bean.vo.StateOrder;
import com.hairline.bean.vo.StateUser;
import com.hairline.mapper.StatOrderMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;

@Service
public class ServiceStatImpl implements ServiceStat{
    @Autowired
    StatOrderMapper statOrderMapper;

    @Override
    public StateOrder getStatOrder() {
        List<StatOrderRowsBean> rows = statOrderMapper.selectStatOrder();
        StateOrder stateOrder = new StateOrder();
        List<String> columns = new ArrayList<>();
        columns.add("day");
        columns.add("orders");
        columns.add("customers");
        columns.add("amount");
        columns.add("pcr");
        stateOrder.setColumns(columns);
        stateOrder.setRows(rows);
        return stateOrder;
    }

    @Override
    public List<StateUser> getStateUser() {
        return statOrderMapper.selectStatUser();
    }

    @Override
    public List<StatGoods> getStatGoods() {
        return statOrderMapper.selectStatGoods();
    }
}
